/**
 * @file 视口适配服务
 * @description 处理不同设备的视口适配，特别是刘海屏等特殊设备
 */

/**
 * 设置视口适配
 * 检测是否支持 viewport-fit，支持则在 meta 中添加 viewport-fit=cover
 */
export function setupViewport(): void {
  if ('CSS' in window && 
      typeof CSS.supports === 'function' && 
      (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))) {
    const metaTag = document.querySelector('meta[name="viewport"]') as HTMLMetaElement;
    if (metaTag && metaTag instanceof HTMLMetaElement) {
      metaTag.content += ', viewport-fit=cover';
    }
  }
} 